var a = getApp();

Page({
    data: {
        tabIndex: 0,
        resultData: {},
        question: {},
        basic_info: []
    },
    onLoad: function(a) {
        var e = a.record_id, t = decodeURIComponent(a.scene);
        if (t) {
            var n = [];
            n = t.split(",");
            for (var s = 0; s < n.length; s++) {
                var o;
                o = n[s].split("="), console.log(o), "record_id" == o[0] && (e = o[1]);
            }
        }
        this.getDetailsData(e);
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {},
    getDetailsData: function(e) {
        var t = this, n = a.getNetAddresss("plugin.health-assessment.api.index.getData");
        a._postNetWork({
            url: n,
            data: {
                art: "getDetail",
                record_id: e
            },
            success: function(a) {
                var e = a.data;
                if (1 == e.result) {
                    var n = e.data.getDetail.result, s = e.data.getDetail.question;
                    console.log("成功", s);
                    for (var o = [], i = 0; i < s.basic.length; i++) {
                        var c = {};
                        if ("1" == s.basic[i].type) c.name = "性别", c.company_name = "", c.answer = s.basic[i].answer; else {
                            if ("2" == s.basic[i].type) {
                                c.name = "年龄", c.company_name = "", c.answer = n.age;
                                continue;
                            }
                            if ("5" == s.basic[i].type || "6" == s.basic[i].type) continue;
                            c.name = s.basic[i].name, c.company_name = s.basic[i].company_name, c.answer = s.basic[i].answer;
                        }
                        o.push(c);
                    }
                    t.setData({
                        resultData: n,
                        question: s,
                        basic_info: o
                    });
                }
            },
            fail: function(a) {
                console.log(a.msg);
            }
        });
    },
    setTabs: function(a) {
        var e = a.target.dataset.index;
        e != this.data.tabIndex && (this.setData({
            tabIndex: e
        }), console.log(a.target.dataset.index));
    }
});